<!DOCTYPE html>
<html>
  <head>
    <meta charset='utf-8'>
    <meta content='width=device-width, initial-scale=1.0' name='viewport'>
    <meta content='' name='description'>
    <meta content='Nils Nordman' name='author'>
    <link href='/images/howl.png' rel='shortcut icon'>
    <title>Howl :: Spec - howl.modes.DefaultMode</title>
    <link href="/stylesheets/bootstrap.min.css" media="screen" rel="stylesheet" type="text/css" />
    <link href="/stylesheets/syntax.css" media="screen" rel="stylesheet" type="text/css" />
    <link href="/stylesheets/howl.css" media="screen" rel="stylesheet" type="text/css" />
    <link href='//fonts.googleapis.com/css?family=Josefin+Slab' rel='stylesheet' type='text/css'>
    <link href='//fonts.googleapis.com/css?family=Open+Sans+Condensed:700' rel='stylesheet' type='text/css'>
  </head>
  <body class='doc doc_spec doc_spec_modes doc_spec_modes_default_mode_spec'>
    <div class='container'>
      <div class='masthead'>
        <ul class='nav nav-pills'>
          <li>
            <a href='/'>
              <span class='glyphicon glyphicon-home'></span>
              Home
            </a>
          </li>
          <li>
            <a href='/doc/'>
              <span class='glyphicon glyphicon-book'></span>
              Documentation
            </a>
          </li>
          <li>
            <a href='/blog/'>
              <span class='glyphicon glyphicon-bullhorn'></span>
              Blog
            </a>
          </li>
          <li>
            <a href='/contact.html'>
              <span class='glyphicon glyphicon-inbox'></span>
              Contact
            </a>
          </li>
        </ul>
      </div>
      <ol class="breadcrumb"><li><a href="/">Home</a></li><li><a href='../../'>Howl 0.3 Documentation</a></li><li>Spec</li><li>Modes</li><li>Spec - howl.modes.DefaultMode</li></ol>
      <div class="spec-group spec-group-1">&#x000A;&#x000A;<h1 id="howl.modes.defaultmode">howl.modes.DefaultMode</h1>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="kd">local</span><span class="w"> </span><span class="n">buffer</span><span class="p">,</span><span class="w"> </span><span class="n">mode</span><span class="p">,</span><span class="w"> </span><span class="n">lines</span><span class="p">,</span><span class="w"> </span><span class="n">indentation</span><span class="w">&#x000A;</span><span class="n">editor</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Editor</span><span class="w"> </span><span class="nc">Buffer</span><span class="w"> </span><span class="p">{}</span><span class="w">&#x000A;</span><span class="n">cursor</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">editor</span><span class="p">.</span><span class="n">cursor</span><span class="w">&#x000A;</span><span class="n">selection</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">editor</span><span class="p">.</span><span class="n">selection</span><span class="w">&#x000A;&#x000A;</span><span class="n">indent</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">selection</span><span class="o">\</span><span class="n">select_all</span><span class="o">!</span><span class="w">&#x000A;  </span><span class="n">mode</span><span class="o">\</span><span class="n">indent</span><span class="w"> </span><span class="n">editor</span><span class="w">&#x000A;&#x000A;</span><span class="n">before_each</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">buffer</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Buffer</span><span class="w"> </span><span class="p">{}</span><span class="w">&#x000A;  </span><span class="n">mode</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">DefaultMode</span><span class="o">!</span><span class="w">&#x000A;  </span><span class="n">indentation</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{}</span><span class="w">&#x000A;  </span><span class="n">mode</span><span class="p">.</span><span class="n">indentation</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">indentation</span><span class="w">&#x000A;  </span><span class="n">buffer</span><span class="p">.</span><span class="n">mode</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">mode</span><span class="w">&#x000A;  </span><span class="n">buffer</span><span class="p">.</span><span class="n">config</span><span class="p">.</span><span class="n">indent</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">2</span><span class="w">&#x000A;  </span><span class="n">lines</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">lines</span><span class="w">&#x000A;  </span><span class="n">editor</span><span class="p">.</span><span class="n">buffer</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">buffer</span></code></pre>&#x000A;&#x000A;<div class="spec-group spec-group-2">&#x000A;&#x000A;<h2 id=".indent">.indent<span class="arg-list">()</span></h2>&#x000A;&#x000A;<h4 id="does-not-try-to-indent-lines-within-comments-or-strings">does not try to indent lines within comments or strings</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">indentation</span><span class="p">.</span><span class="n">more_after</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="s1">'{'</span><span class="w"> </span><span class="p">}</span><span class="w">&#x000A;  </span><span class="n">indentation</span><span class="p">.</span><span class="n">less_for</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="s1">'}'</span><span class="w"> </span><span class="p">}</span><span class="w">&#x000A;  </span><span class="n">buffer</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">ActionBuffer</span><span class="o">!</span><span class="w">&#x000A;  </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'{\nfoo\n  }\n'</span><span class="w">&#x000A;  </span><span class="n">lines</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">lines</span><span class="w">&#x000A;  </span><span class="n">buffer</span><span class="o">\</span><span class="n">style</span><span class="w"> </span><span class="n">lines</span><span class="p">[</span><span class="mi">1</span><span class="p">].</span><span class="n">start_pos</span><span class="p">,</span><span class="w"> </span><span class="n">lines</span><span class="p">[</span><span class="mi">2</span><span class="p">].</span><span class="n">end_pos</span><span class="p">,</span><span class="w"> </span><span class="s1">'comment'</span><span class="w">&#x000A;  </span><span class="n">buffer</span><span class="o">\</span><span class="n">style</span><span class="w"> </span><span class="n">lines</span><span class="p">[</span><span class="mi">3</span><span class="p">].</span><span class="n">start_pos</span><span class="p">,</span><span class="w"> </span><span class="n">lines</span><span class="p">[</span><span class="mi">4</span><span class="p">].</span><span class="n">end_pos</span><span class="p">,</span><span class="w"> </span><span class="s1">'string'</span><span class="w">&#x000A;  </span><span class="n">editor</span><span class="p">.</span><span class="n">buffer</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">buffer</span><span class="w">&#x000A;  </span><span class="n">indent</span><span class="o">!</span><span class="w">&#x000A;  </span><span class="n">assert</span><span class="p">.</span><span class="n">equals</span><span class="w"> </span><span class="s1">'{\nfoo\n  }\n'</span><span class="p">,</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="uses-the-same-indent-as-for-the-previous-line-if-it-is-a-comment">uses the same indent as for the previous line if it is a comment</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">indentation</span><span class="p">.</span><span class="n">more_after</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="s1">'{'</span><span class="w"> </span><span class="p">}</span><span class="w">&#x000A;  </span><span class="n">mode</span><span class="p">.</span><span class="n">comment_syntax</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'#'</span><span class="w">&#x000A;  </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"  # I'm commenting thank you very much {\n# and still are\n"</span><span class="w">&#x000A;  </span><span class="n">indent</span><span class="o">!</span><span class="w">&#x000A;  </span><span class="n">assert</span><span class="p">.</span><span class="n">equals</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w"> </span><span class="n">lines</span><span class="p">[</span><span class="mi">2</span><span class="p">].</span><span class="n">indentation</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="adjust-any-illegal-indentation-(not-divisable-by-indent)">adjust any illegal indentation (not divisable by indent)</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'  line\n two\n'</span><span class="w">&#x000A;</span><span class="n">indent</span><span class="o">!</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equals</span><span class="w"> </span><span class="s1">'  line\n  two\n'</span><span class="p">,</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="works-on-the-current-line-if-no-selection-is-specified">works on the current line if no selection is specified</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">indentation</span><span class="p">.</span><span class="n">more_after</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="s1">'if'</span><span class="w"> </span><span class="p">}</span><span class="w">&#x000A;</span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'if\none\ntwo\n'</span><span class="w">&#x000A;</span><span class="n">cursor</span><span class="p">.</span><span class="n">line</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">2</span><span class="w">&#x000A;</span><span class="n">mode</span><span class="o">\</span><span class="n">indent</span><span class="w"> </span><span class="n">editor</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equals</span><span class="w"> </span><span class="s1">'if\n  one\ntwo\n'</span><span class="p">,</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="moves-the-cursor-to-the-beginning-of-indentation-if-it-would-be-positioned-before">moves the cursor to the beginning of indentation if it would be positioned before</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'  line\n\n'</span><span class="w">&#x000A;</span><span class="n">cursor</span><span class="p">.</span><span class="n">line</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">2</span><span class="w">&#x000A;</span><span class="n">mode</span><span class="o">\</span><span class="n">indent</span><span class="w"> </span><span class="n">editor</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equals</span><span class="w"> </span><span class="s1">'  line\n  \n'</span><span class="p">,</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equals</span><span class="w"> </span><span class="mi">3</span><span class="p">,</span><span class="w"> </span><span class="n">cursor</span><span class="p">.</span><span class="n">column</span></code></pre>&#x000A;&#x000A;<div class="spec-group spec-group-3">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(when .indentation.more_after patterns is set)</span></h3>&#x000A;<div class="spec-group spec-group-4">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(..  and the previous line matches one of the patterns)</span></h3>&#x000A;&#x000A;<h4 id="indents-lines-below-matching-lines-with-the-currently-set-indent">indents lines below matching lines with the currently set indent</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">indentation</span><span class="p">.</span><span class="n">more_after</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">r</span><span class="s1">'if'</span><span class="p">,</span><span class="w"> </span><span class="s1">'then'</span><span class="w"> </span><span class="p">}</span><span class="w">&#x000A;</span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'if\nbar\nthen\nfoo\n'</span><span class="w">&#x000A;</span><span class="n">indent</span><span class="o">!</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equals</span><span class="w"> </span><span class="s1">'if\n  bar\nthen\n  foo\n'</span><span class="p">,</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span></code></pre>&#x000A;&#x000A;<div class="spec-group spec-group-5">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(..  when .authoritive is not false)</span></h3>&#x000A;&#x000A;<h4 id="adjusts-lines-with-unwarranted-greater-indents-to-match-the-previous-line">adjusts lines with unwarranted greater indents to match the previous line</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">indentation</span><span class="p">.</span><span class="n">more_after</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="s1">'if'</span><span class="w"> </span><span class="p">}</span><span class="w">&#x000A;</span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'line\n  wat?\n'</span><span class="w">&#x000A;</span><span class="n">indent</span><span class="o">!</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equals</span><span class="w"> </span><span class="s1">'line\nwat?\n'</span><span class="p">,</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span></code></pre>&#x000A;&#x000A;</div>&#x000A;<div class="spec-group spec-group-5">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(..  when .authoritive is false)</span></h3>&#x000A;&#x000A;<h4 id="does-not-adjust-lines-with-unwarranted-greater-indents-to-match-the-previous-line">does not adjust lines with unwarranted greater indents to match the previous line</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">indentation</span><span class="p">.</span><span class="n">more_after</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="s1">'if'</span><span class="p">,</span><span class="w"> </span><span class="ss">authoritive:</span><span class="w"> </span><span class="kc">false</span><span class="w"> </span><span class="p">}</span><span class="w">&#x000A;</span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'line\n  wat?\n'</span><span class="w">&#x000A;</span><span class="n">indent</span><span class="o">!</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equals</span><span class="w"> </span><span class="s1">'line\n  wat?\n'</span><span class="p">,</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span></code></pre>&#x000A;&#x000A;</div>&#x000A;</div>&#x000A;</div>&#x000A;<div class="spec-group spec-group-3">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(when .indentation.less_for is set)</span></h3>&#x000A;<div class="spec-group spec-group-4">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(..  and the current line matches one of the patterns)</span></h3>&#x000A;&#x000A;<h4 id="dedents-the-line-one-level-below-the-previous-line-if-it-exists">dedents the line one level below the previous line if it exists</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">indentation</span><span class="p">.</span><span class="n">less_for</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">r</span><span class="s1">'else'</span><span class="p">,</span><span class="w"> </span><span class="s1">'}'</span><span class="w"> </span><span class="p">}</span><span class="w">&#x000A;</span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'    bar\n    else\n  foo\n  }\n'</span><span class="w">&#x000A;</span><span class="n">indent</span><span class="o">!</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equals</span><span class="w"> </span><span class="s1">'    bar\n  else\n  foo\n}\n'</span><span class="p">,</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span></code></pre>&#x000A;&#x000A;<div class="spec-group spec-group-5">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(..  when .authoritive is not false)</span></h3>&#x000A;&#x000A;<h4 id="adjusts-lines-with-unwarranted-smaller-indents-to-match-the-previous-line">adjusts lines with unwarranted smaller indents to match the previous line</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">indentation</span><span class="p">.</span><span class="n">less_for</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="s1">'else'</span><span class="w"> </span><span class="p">}</span><span class="w">&#x000A;</span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'  line\nwat?\n'</span><span class="w">&#x000A;</span><span class="n">indent</span><span class="o">!</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equals</span><span class="w"> </span><span class="s1">'  line\n  wat?\n'</span><span class="p">,</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span></code></pre>&#x000A;&#x000A;</div>&#x000A;<div class="spec-group spec-group-5">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(..  when .authoritive is false)</span></h3>&#x000A;&#x000A;<h4 id="does-not-adjust-lines-with-unwarranted-smaller-indents-to-match-the-previous-line">does not adjust lines with unwarranted smaller indents to match the previous line</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">indentation</span><span class="p">.</span><span class="n">less_for</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="s1">'else'</span><span class="p">,</span><span class="w"> </span><span class="ss">authoritive:</span><span class="w"> </span><span class="kc">false</span><span class="w"> </span><span class="p">}</span><span class="w">&#x000A;</span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'  line\nwat?\n'</span><span class="w">&#x000A;</span><span class="n">indent</span><span class="o">!</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equals</span><span class="w"> </span><span class="s1">'  line\nwat?\n'</span><span class="p">,</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span></code></pre>&#x000A;&#x000A;</div>&#x000A;</div>&#x000A;</div>&#x000A;<div class="spec-group spec-group-3">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(when .indentation.more_for is set)</span></h3>&#x000A;<div class="spec-group spec-group-4">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(..  and the current line matches one of the patterns)</span></h3>&#x000A;&#x000A;<h4 id="indents-the-line-one-level-right-of-the-previous-line-if-it-exists">indents the line one level right of the previous line if it exists</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">indentation</span><span class="p">.</span><span class="n">more_for</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="s1">'^.'</span><span class="w"> </span><span class="p">}</span><span class="w">&#x000A;</span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'bar\n.foo\n'</span><span class="w">&#x000A;</span><span class="n">indent</span><span class="o">!</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equals</span><span class="w"> </span><span class="s1">'bar\n  .foo\n'</span><span class="p">,</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span></code></pre>&#x000A;&#x000A;</div>&#x000A;</div>&#x000A;<div class="spec-group spec-group-3">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(when .indentation.same_after patterns is set)</span></h3>&#x000A;<div class="spec-group spec-group-4">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(..  and the previous line matches one of the patterns)</span></h3>&#x000A;&#x000A;<h4 id="indents-lines-below-matching-lines-to-have-the-same-indent-as-the-previous-line">indents lines below matching lines to have the same indent as the previous line</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">indentation</span><span class="p">.</span><span class="n">same_after</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">',$'</span><span class="w">&#x000A;</span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'  foo,\nbar'</span><span class="w">&#x000A;</span><span class="n">indent</span><span class="o">!</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equals</span><span class="w"> </span><span class="s1">'  foo,\n  bar'</span><span class="p">,</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span></code></pre>&#x000A;&#x000A;</div>&#x000A;</div>&#x000A;<div class="spec-group spec-group-3">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(when more than one of .less_for, .more_after or .same_after are set)</span></h3>&#x000A;&#x000A;<h4 id="they-are-weighed-together">they are weighed together</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">indentation</span><span class="p">.</span><span class="n">more_after</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="s1">'{'</span><span class="w"> </span><span class="p">}</span><span class="w">&#x000A;</span><span class="n">indentation</span><span class="p">.</span><span class="n">less_for</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="s1">'}'</span><span class="w"> </span><span class="p">}</span><span class="w">&#x000A;</span><span class="n">indentation</span><span class="p">.</span><span class="n">same_after</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="s1">',$'</span><span class="w"> </span><span class="p">}</span><span class="w">&#x000A;</span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'  {\n  }'</span><span class="w">&#x000A;</span><span class="n">indent</span><span class="o">!</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equals</span><span class="w"> </span><span class="s1">'  {\n  }'</span><span class="p">,</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w">&#x000A;&#x000A;</span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'  {\n  foo,}'</span><span class="w">&#x000A;</span><span class="n">indent</span><span class="o">!</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equals</span><span class="w"> </span><span class="s1">'  {\n  foo,}'</span><span class="p">,</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span></code></pre>&#x000A;&#x000A;</div>&#x000A;<div class="spec-group spec-group-3">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(when a line is blank)</span></h3>&#x000A;&#x000A;<h4 id="does-not-indent-unless-it-is-the-current-line">does not indent unless it is the current line</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">indentation</span><span class="p">.</span><span class="n">more_after</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="s1">'{'</span><span class="w"> </span><span class="p">}</span><span class="w">&#x000A;  </span><span class="n">indentation</span><span class="p">.</span><span class="n">less_for</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="s1">'}'</span><span class="w"> </span><span class="p">}</span><span class="w">&#x000A;  </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'{\n\n}'</span><span class="w">&#x000A;  </span><span class="n">indent</span><span class="o">!</span><span class="w">&#x000A;  </span><span class="n">assert</span><span class="p">.</span><span class="n">equals</span><span class="w"> </span><span class="s1">'{\n\n}'</span><span class="p">,</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span></code></pre>&#x000A;&#x000A;<div class="spec-group spec-group-4">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(..  and it is the current line)</span></h3>&#x000A;&#x000A;<h4 id="indents-according-to-patterns">indents according to patterns</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">indentation</span><span class="p">.</span><span class="n">more_after</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="s1">'{'</span><span class="w"> </span><span class="p">}</span><span class="w">&#x000A;  </span><span class="n">indentation</span><span class="p">.</span><span class="n">less_for</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="s1">'}'</span><span class="w"> </span><span class="p">}</span><span class="w">&#x000A;  </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'{\n\n}'</span><span class="w">&#x000A;  </span><span class="n">cursor</span><span class="p">.</span><span class="n">line</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">2</span><span class="w">&#x000A;  </span><span class="n">mode</span><span class="o">\</span><span class="n">indent</span><span class="w"> </span><span class="n">editor</span><span class="w">&#x000A;  </span><span class="n">assert</span><span class="p">.</span><span class="n">equals</span><span class="w"> </span><span class="s1">'{\n  \n}'</span><span class="p">,</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="sets-the-same-indent-as-for-the-previous-line-if-nothing-else-is-specified">sets the same indent as for the previous line if nothing else is specified</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'  line\n\n'</span><span class="w">&#x000A;</span><span class="n">cursor</span><span class="p">.</span><span class="n">line</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">2</span><span class="w">&#x000A;</span><span class="n">mode</span><span class="o">\</span><span class="n">indent</span><span class="w"> </span><span class="n">editor</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equals</span><span class="w"> </span><span class="s1">'  line\n  \n'</span><span class="p">,</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span></code></pre>&#x000A;&#x000A;</div>&#x000A;</div>&#x000A;</div>&#x000A;<div class="spec-group spec-group-2">&#x000A;&#x000A;<h2 id="comment">comment<span class="arg-list">(editor)</span></h2>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="sh">[[&#x000A;  liñe 1&#x000A;&#x000A;liñe 2&#x000A;liñe 3&#x000A;  ]]</span><span class="w">&#x000A;</span><span class="n">before_each</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">text</span><span class="w">&#x000A;  </span><span class="n">selection</span><span class="o">\</span><span class="n">set</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="n">lines</span><span class="p">[</span><span class="mi">4</span><span class="p">].</span><span class="n">start_pos</span></code></pre>&#x000A;&#x000A;<div class="spec-group spec-group-3">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(when .comment_syntax is not set)</span></h3>&#x000A;&#x000A;<h4 id="does-nothing">does nothing</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">mode</span><span class="o">\</span><span class="n">comment</span><span class="w"> </span><span class="n">editor</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="n">text</span><span class="p">,</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span></code></pre>&#x000A;&#x000A;</div>&#x000A;<div class="spec-group spec-group-3">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(when .comment_syntax is set to a string)</span></h3>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">before_each</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="n">mode</span><span class="p">.</span><span class="n">comment_syntax</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'--'</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="prefixes-the-selected-lines-with-the-prefix-and-a-space,-at-the-minimum-indentation-level">prefixes the selected lines with the prefix and a space, at the minimum indentation level</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">mode</span><span class="o">\</span><span class="n">comment</span><span class="w"> </span><span class="n">editor</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="sh">[[&#x000A;&#x000A;    liñe 3&#x000A;  ]]</span><span class="p">,</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="comments-the-current-line-if-nothing-is-selected">comments the current line if nothing is selected</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">selection</span><span class="o">\</span><span class="n">remove</span><span class="o">!</span><span class="w">&#x000A;</span><span class="n">cursor</span><span class="p">.</span><span class="n">pos</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">1</span><span class="w">&#x000A;</span><span class="n">mode</span><span class="o">\</span><span class="n">comment</span><span class="w"> </span><span class="n">editor</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="sh">[[&#x000A;&#x000A;    liñe 2&#x000A;    liñe 3&#x000A;  ]]</span><span class="p">,</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="keeps-the-cursor-position">keeps the cursor position</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">editor</span><span class="p">.</span><span class="n">selection</span><span class="p">.</span><span class="n">cursor</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">lines</span><span class="p">[</span><span class="mi">3</span><span class="p">].</span><span class="n">start_pos</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">2</span><span class="w">&#x000A;</span><span class="n">mode</span><span class="o">\</span><span class="n">comment</span><span class="w"> </span><span class="n">editor</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="mi">6</span><span class="p">,</span><span class="w"> </span><span class="n">cursor</span><span class="p">.</span><span class="n">column</span></code></pre>&#x000A;&#x000A;</div>&#x000A;<div class="spec-group spec-group-3">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(when .comment_syntax is set to a pair)</span></h3>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">before_each</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="n">mode</span><span class="p">.</span><span class="n">comment_syntax</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="s1">'/*'</span><span class="p">,</span><span class="w"> </span><span class="s1">'*/'</span><span class="p">}</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="wraps-each-selected-line-with-the-pair,-at-the-minimum-indentation-level">wraps each selected line with the pair, at the minimum indentation level</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">mode</span><span class="o">\</span><span class="n">comment</span><span class="w"> </span><span class="n">editor</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="sh">[[&#x000A;  /* liñe 1 */&#x000A;&#x000A;  /*   liñe 2 */&#x000A;    liñe 3&#x000A;  ]]</span><span class="p">,</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="comments-the-current-line-if-nothing-is-selected">comments the current line if nothing is selected</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">selection</span><span class="o">\</span><span class="n">remove</span><span class="o">!</span><span class="w">&#x000A;</span><span class="n">cursor</span><span class="p">.</span><span class="n">pos</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">1</span><span class="w">&#x000A;</span><span class="n">mode</span><span class="o">\</span><span class="n">comment</span><span class="w"> </span><span class="n">editor</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="sh">[[&#x000A;  /* liñe 1 */&#x000A;&#x000A;    liñe 2&#x000A;    liñe 3&#x000A;  ]]</span><span class="p">,</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="keeps-the-cursor-position">keeps the cursor position</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">editor</span><span class="p">.</span><span class="n">selection</span><span class="p">.</span><span class="n">cursor</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">lines</span><span class="p">[</span><span class="mi">3</span><span class="p">].</span><span class="n">start_pos</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">2</span><span class="w">&#x000A;</span><span class="n">mode</span><span class="o">\</span><span class="n">comment</span><span class="w"> </span><span class="n">editor</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="mi">6</span><span class="p">,</span><span class="w"> </span><span class="n">cursor</span><span class="p">.</span><span class="n">column</span></code></pre>&#x000A;&#x000A;</div>&#x000A;</div>&#x000A;<div class="spec-group spec-group-2">&#x000A;&#x000A;<h2 id="uncomment">uncomment<span class="arg-list">(editor)</span></h2>&#x000A;<div class="spec-group spec-group-3">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(when .comment_syntax is not set)</span></h3>&#x000A;&#x000A;<h4 id="does-nothing">does nothing</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'foo\nbar\n'</span><span class="w">&#x000A;</span><span class="n">selection</span><span class="o">\</span><span class="n">set</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="n">lines</span><span class="p">[</span><span class="mi">2</span><span class="p">].</span><span class="n">start_pos</span><span class="w">&#x000A;</span><span class="n">mode</span><span class="o">\</span><span class="n">uncomment</span><span class="w"> </span><span class="n">editor</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'foo\nbar\n'</span><span class="p">,</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span></code></pre>&#x000A;&#x000A;</div>&#x000A;<div class="spec-group spec-group-3">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(when .comment_syntax is set to a string)</span></h3>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">before_each</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">buffer</span><span class="p">.</span><span class="n">mode</span><span class="p">.</span><span class="n">comment_syntax</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'--'</span><span class="w">&#x000A;  </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="sh">[[&#x000A;]]</span><span class="w">&#x000A;  </span><span class="n">selection</span><span class="o">\</span><span class="n">set</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="n">lines</span><span class="p">[</span><span class="mi">3</span><span class="p">].</span><span class="n">start_pos</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="removes-the-first-instance-of-the-comment-prefix-and-optional-space-from-each-line">removes the first instance of the comment prefix and optional space from each line</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">mode</span><span class="o">\</span><span class="n">uncomment</span><span class="w"> </span><span class="n">editor</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="sh">[[&#x000A;   liñe 1&#x000A;]]</span><span class="p">,</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="uncomments-the-current-line-if-nothing-is-selected">uncomments the current line if nothing is selected</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">selection</span><span class="o">\</span><span class="n">remove</span><span class="o">!</span><span class="w">&#x000A;</span><span class="n">cursor</span><span class="p">.</span><span class="n">line</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">2</span><span class="w">&#x000A;</span><span class="n">mode</span><span class="o">\</span><span class="n">uncomment</span><span class="w"> </span><span class="n">editor</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="sh">[[&#x000A;]]</span><span class="p">,</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="keeps-the-cursor-position">keeps the cursor position</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">editor</span><span class="p">.</span><span class="n">selection</span><span class="p">.</span><span class="n">cursor</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">lines</span><span class="p">[</span><span class="mi">2</span><span class="p">].</span><span class="n">start_pos</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">6</span><span class="w">&#x000A;</span><span class="n">mode</span><span class="o">\</span><span class="n">uncomment</span><span class="w"> </span><span class="n">editor</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="mi">4</span><span class="p">,</span><span class="w"> </span><span class="n">cursor</span><span class="p">.</span><span class="n">column</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="does-nothing-for-lines-that-are-not-commented">does nothing for lines that are not commented</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"line\n"</span><span class="w">&#x000A;</span><span class="n">cursor</span><span class="p">.</span><span class="n">line</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">1</span><span class="w">&#x000A;</span><span class="n">mode</span><span class="o">\</span><span class="n">uncomment</span><span class="w"> </span><span class="n">editor</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s2">"line\n"</span><span class="p">,</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span></code></pre>&#x000A;&#x000A;</div>&#x000A;<div class="spec-group spec-group-3">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(when .comment_syntax is set to a pair)</span></h3>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">before_each</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">buffer</span><span class="p">.</span><span class="n">mode</span><span class="p">.</span><span class="n">comment_syntax</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="s1">'/*'</span><span class="p">,</span><span class="w"> </span><span class="s1">'*/'</span><span class="p">}</span><span class="w">&#x000A;  </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="sh">[[&#x000A;  /*  liñe 1 */&#x000A;    /* liñe 2 */&#x000A;    /*liñe 3*/&#x000A;]]</span><span class="w">&#x000A;  </span><span class="n">selection</span><span class="o">\</span><span class="n">set</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="n">lines</span><span class="p">[</span><span class="mi">3</span><span class="p">].</span><span class="n">start_pos</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="removes-the-first-instance-of-the-comment-prefix-and-optional-space-from-each-line">removes the first instance of the comment prefix and optional space from each line</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">mode</span><span class="o">\</span><span class="n">uncomment</span><span class="w"> </span><span class="n">editor</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="sh">[[&#x000A;   liñe 1&#x000A;    liñe 2&#x000A;    /*liñe 3*/&#x000A;]]</span><span class="p">,</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="uncomments-the-current-line-if-nothing-is-selected">uncomments the current line if nothing is selected</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">selection</span><span class="o">\</span><span class="n">remove</span><span class="o">!</span><span class="w">&#x000A;</span><span class="n">cursor</span><span class="p">.</span><span class="n">line</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">2</span><span class="w">&#x000A;</span><span class="n">mode</span><span class="o">\</span><span class="n">uncomment</span><span class="w"> </span><span class="n">editor</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="sh">[[&#x000A;  /*  liñe 1 */&#x000A;    liñe 2&#x000A;    /*liñe 3*/&#x000A;]]</span><span class="p">,</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="keeps-the-cursor-position">keeps the cursor position</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">editor</span><span class="p">.</span><span class="n">selection</span><span class="p">.</span><span class="n">cursor</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">lines</span><span class="p">[</span><span class="mi">2</span><span class="p">].</span><span class="n">start_pos</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">6</span><span class="w">&#x000A;</span><span class="n">mode</span><span class="o">\</span><span class="n">uncomment</span><span class="w"> </span><span class="n">editor</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="mi">4</span><span class="p">,</span><span class="w"> </span><span class="n">cursor</span><span class="p">.</span><span class="n">column</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="does-nothing-for-lines-that-are-not-commented">does nothing for lines that are not commented</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"line\n"</span><span class="w">&#x000A;</span><span class="n">cursor</span><span class="p">.</span><span class="n">line</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">1</span><span class="w">&#x000A;</span><span class="n">mode</span><span class="o">\</span><span class="n">uncomment</span><span class="w"> </span><span class="n">editor</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s2">"line\n"</span><span class="p">,</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span></code></pre>&#x000A;&#x000A;</div>&#x000A;</div>&#x000A;<div class="spec-group spec-group-2">&#x000A;&#x000A;<h2 id="toggle_comment">toggle_comment<span class="arg-list">(editor)</span></h2>&#x000A;<div class="spec-group spec-group-3">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(when mode does not provide .comment_syntax)</span></h3>&#x000A;&#x000A;<h4 id="does-nothing">does nothing</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'-- foo'</span><span class="w">&#x000A;</span><span class="n">mode</span><span class="o">\</span><span class="n">toggle_comment</span><span class="w"> </span><span class="n">editor</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'-- foo'</span><span class="p">,</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span></code></pre>&#x000A;&#x000A;</div>&#x000A;<div class="spec-group spec-group-3">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(when mode provides .comment_syntax)</span></h3>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">before_each</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">mode</span><span class="p">.</span><span class="n">comment_syntax</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'--'</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="it-uncomments-if-the-first-line-starts-with-the-comment-prefix">it uncomments if the first line starts with the comment prefix</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'  -- foo'</span><span class="w">&#x000A;</span><span class="n">mode</span><span class="o">\</span><span class="n">toggle_comment</span><span class="w"> </span><span class="n">editor</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'  foo'</span><span class="p">,</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="comments-if-the-first-line-do-no-start-with-the-comment-prefix">comments if the first line do no start with the comment prefix</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'foo'</span><span class="w">&#x000A;</span><span class="n">mode</span><span class="o">\</span><span class="n">toggle_comment</span><span class="w"> </span><span class="n">editor</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'-- foo'</span><span class="p">,</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span></code></pre>&#x000A;&#x000A;</div>&#x000A;</div>&#x000A;<div class="spec-group spec-group-2">&#x000A;&#x000A;<h2 id="auto-formatting-after-newline">auto-formatting after newline</h2>&#x000A;&#x000A;<h4 id="indents-the-new-line-automatically-given-the-indent-patterns">indents the new line automatically given the indent patterns</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">indentation</span><span class="p">.</span><span class="n">more_after</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="s1">'if'</span><span class="w"> </span><span class="p">}</span><span class="w">&#x000A;</span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'if'</span><span class="w">&#x000A;</span><span class="n">cursor</span><span class="o">\</span><span class="n">eof</span><span class="o">!</span><span class="w">&#x000A;</span><span class="n">editor</span><span class="o">\</span><span class="n">newline</span><span class="o">!</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equals</span><span class="w"> </span><span class="s1">'if\n  '</span><span class="p">,</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w">&#x000A;&#x000A;</span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'other'</span><span class="w">&#x000A;</span><span class="n">cursor</span><span class="o">\</span><span class="n">eof</span><span class="o">!</span><span class="w">&#x000A;</span><span class="n">editor</span><span class="o">\</span><span class="n">newline</span><span class="o">!</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equals</span><span class="w"> </span><span class="s1">'other\n'</span><span class="p">,</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span></code></pre>&#x000A;&#x000A;</div>&#x000A;<div class="spec-group spec-group-2">&#x000A;&#x000A;<h2 id="structure">structure<span class="arg-list">()</span></h2>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">assert_lines</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">(</span><span class="n">expected</span><span class="p">,</span><span class="w"> </span><span class="n">actual</span><span class="p">)</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="p">[</span><span class="n">l</span><span class="p">.</span><span class="n">nr</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">l</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="o">*</span><span class="n">expected</span><span class="p">],</span><span class="w"> </span><span class="p">[</span><span class="n">l</span><span class="p">.</span><span class="n">nr</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">l</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="o">*</span><span class="n">actual</span><span class="p">]</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="returns-a-simple-indentation-based-structure">returns a simple indentation-based structure</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="sh">[[&#x000A;  header1&#x000A;    sub1&#x000A;      foo&#x000A;      bar&#x000A;      zed&#x000A;      froz&#x000A;  header2&#x000A;    sub2&#x000A;]]</span><span class="w">&#x000A;</span><span class="n">assert_lines</span><span class="w"> </span><span class="p">{</span><span class="w">&#x000A;  </span><span class="n">lines</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="w">&#x000A;  </span><span class="n">lines</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="w">&#x000A;  </span><span class="n">lines</span><span class="p">[</span><span class="mi">7</span><span class="p">]</span><span class="w">&#x000A;</span><span class="p">},</span><span class="w"> </span><span class="n">mode</span><span class="o">\</span><span class="n">structure</span><span class="w"> </span><span class="n">editor</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="the-config-variable-indentation_structure_threshold-determines-when-it-stops">the config variable indentation_structure_threshold determines when it stops</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="sh">[[&#x000A;  header1&#x000A;    sub1&#x000A;      froz&#x000A;  header2&#x000A;    sub2&#x000A;]]</span><span class="w">&#x000A;</span><span class="n">buffer</span><span class="p">.</span><span class="n">config</span><span class="p">.</span><span class="n">indentation_structure_threshold</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">2</span><span class="w">&#x000A;</span><span class="n">assert_lines</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">lines</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span><span class="w"> </span><span class="n">lines</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span><span class="w"> </span><span class="p">},</span><span class="w"> </span><span class="n">mode</span><span class="o">\</span><span class="n">structure</span><span class="w"> </span><span class="n">editor</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="disregards-blank-lines">disregards blank lines</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'\n  sub\n'</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="p">{},</span><span class="w"> </span><span class="n">mode</span><span class="o">\</span><span class="n">structure</span><span class="w"> </span><span class="n">editor</span></code></pre>&#x000A;&#x000A;<div class="spec-group spec-group-3">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(if a structure line is all non-alpha)</span></h3>&#x000A;&#x000A;<h4 id="tries-to-use-the-previous-line-if-that-contains-alpha-characters">tries to use the previous line if that contains alpha characters</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="sh">[[&#x000A;  int func(int arg)&#x000A;  {&#x000A;    froz();&#x000A;  }&#x000A;]]</span><span class="w">&#x000A;</span><span class="n">assert_lines</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">lines</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="w"> </span><span class="p">},</span><span class="w"> </span><span class="n">mode</span><span class="o">\</span><span class="n">structure</span><span class="w"> </span><span class="n">editor</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="skips-the-line-altogether-if-the-previous-line-does-not-contain-alpha-characters">skips the line altogether if the previous line does not contain alpha characters</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="sh">[[&#x000A;&#x000A;  {&#x000A;    froz();&#x000A;  }&#x000A;]]</span><span class="w">&#x000A;</span><span class="n">assert_lines</span><span class="w"> </span><span class="p">{},</span><span class="w"> </span><span class="n">mode</span><span class="o">\</span><span class="n">structure</span><span class="w"> </span><span class="n">editor</span></code></pre>&#x000A;&#x000A;</div>&#x000A;</div>&#x000A;<div class="spec-group spec-group-2">&#x000A;&#x000A;<h2 id="patterns_match">patterns_match<span class="arg-list">(text, patterns)</span></h2>&#x000A;&#x000A;<h4 id="returns-a-boolean-indicating-whether-&lt;text&gt;-matches-any-of-the-specified-patterns">returns a boolean indicating whether &lt;text&gt; matches any of the specified patterns</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">assert</span><span class="p">.</span><span class="n">is_true</span><span class="w"> </span><span class="n">mode</span><span class="o">\</span><span class="n">patterns_match</span><span class="w"> </span><span class="s1">'foo'</span><span class="p">,</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="s1">'foo'</span><span class="w"> </span><span class="p">}</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">is_false</span><span class="w"> </span><span class="n">mode</span><span class="o">\</span><span class="n">patterns_match</span><span class="w"> </span><span class="s1">'foo'</span><span class="p">,</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="s1">'bar'</span><span class="w"> </span><span class="p">}</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="accepts-both-lua-patterns-and-regexes">accepts both Lua patterns and regexes</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">assert</span><span class="p">.</span><span class="n">is_true</span><span class="w"> </span><span class="n">mode</span><span class="o">\</span><span class="n">patterns_match</span><span class="w"> </span><span class="s1">'foo'</span><span class="p">,</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="s1">'fo+'</span><span class="w"> </span><span class="p">}</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">is_true</span><span class="w"> </span><span class="n">mode</span><span class="o">\</span><span class="n">patterns_match</span><span class="w"> </span><span class="s1">'foo'</span><span class="p">,</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">r</span><span class="s1">'\\pLo*'</span><span class="w"> </span><span class="p">}</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="a-specifed-pattern-can-be-table-containing-both-a-positiv-and-a-negative-match">a specifed pattern can be table containing both a positiv and a negative match</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">p</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="s1">'foo'</span><span class="p">,</span><span class="w"> </span><span class="s1">'bar'</span><span class="w"> </span><span class="p">}</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">is_true</span><span class="w"> </span><span class="n">mode</span><span class="o">\</span><span class="n">patterns_match</span><span class="w"> </span><span class="s1">'foo zed'</span><span class="p">,</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">p</span><span class="w"> </span><span class="p">}</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">is_false</span><span class="w"> </span><span class="n">mode</span><span class="o">\</span><span class="n">patterns_match</span><span class="w"> </span><span class="s1">'foo bar'</span><span class="p">,</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">p</span><span class="w"> </span><span class="p">}</span></code></pre>&#x000A;&#x000A;</div>&#x000A;<div class="spec-group spec-group-2">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(when a newline is added)</span></h3>&#x000A;&#x000A;<h4 id="sets-the-indentation-for-the-new-line-to-the-indentation-of-the-previous-non-blank-line">sets the indentation for the new line to the indentation of the previous non-blank line</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'  line1\n\nline3'</span><span class="w">&#x000A;</span><span class="n">cursor</span><span class="p">.</span><span class="n">line</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">3</span><span class="w">&#x000A;</span><span class="n">editor</span><span class="o">\</span><span class="n">newline</span><span class="o">!</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equals</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w"> </span><span class="n">editor</span><span class="p">.</span><span class="n">current_line</span><span class="p">.</span><span class="n">indentation</span></code></pre>&#x000A;&#x000A;<div class="spec-group spec-group-3">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(..  when .code_blocks.multiline is present)</span></h3>&#x000A;&#x000A;<h4 id="the-code-blocks-are-automatically-enforced">the code blocks are automatically enforced</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">mode</span><span class="p">.</span><span class="n">code_blocks</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="ss">multiline:</span><span class="w"> </span><span class="p">{</span><span class="w">&#x000A;  </span><span class="p">{</span><span class="w"> </span><span class="s1">'%sdo$'</span><span class="p">,</span><span class="w"> </span><span class="s1">'^%s*end'</span><span class="p">,</span><span class="w"> </span><span class="s1">'end'</span><span class="w"> </span><span class="p">},</span><span class="w">&#x000A;</span><span class="p">}</span><span class="w">&#x000A;</span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'foo do'</span><span class="w">&#x000A;</span><span class="n">cursor</span><span class="o">\</span><span class="n">eof</span><span class="o">!</span><span class="w">&#x000A;</span><span class="n">editor</span><span class="o">\</span><span class="n">newline</span><span class="o">!</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equals</span><span class="w"> </span><span class="s1">'foo do\n\nend\n'</span><span class="p">,</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equals</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w"> </span><span class="n">cursor</span><span class="p">.</span><span class="n">line</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="is-ignored-if-the-configuration-variable-&quot;auto_format&quot;-is-false">is ignored if the configuration variable &quot;auto_format&quot; is false</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">buffer</span><span class="p">.</span><span class="n">config</span><span class="p">.</span><span class="n">auto_format</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">false</span><span class="w">&#x000A;</span><span class="n">mode</span><span class="p">.</span><span class="n">code_blocks</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="ss">multiline:</span><span class="w"> </span><span class="p">{</span><span class="w">&#x000A;  </span><span class="p">{</span><span class="w"> </span><span class="s1">'%sdo$'</span><span class="p">,</span><span class="w"> </span><span class="s1">'^%s*end'</span><span class="p">,</span><span class="w"> </span><span class="s1">'end'</span><span class="w"> </span><span class="p">},</span><span class="w">&#x000A;</span><span class="p">}</span><span class="w">&#x000A;</span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'foo do'</span><span class="w">&#x000A;</span><span class="n">cursor</span><span class="o">\</span><span class="n">eof</span><span class="o">!</span><span class="w">&#x000A;</span><span class="n">editor</span><span class="o">\</span><span class="n">newline</span><span class="o">!</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equals</span><span class="w"> </span><span class="s1">'foo do\n'</span><span class="p">,</span><span class="w"> </span><span class="n">buffer</span><span class="p">.</span><span class="n">text</span></code></pre>&#x000A;&#x000A;</div>&#x000A;</div>&#x000A;</div>
      <div class='footer text-muted'>
        <a href='/'>
          <img width="50" height="50" class="footer-logo" src="/images/howl.png" />
        </a>
        <div class='footer-follow'>
          <p>
            <a class='twitter-follow-button' data-lang='en' data-show-count='false' href='https://twitter.com/howleditor' rel='me'>
              Follow @howleditor
            </a>
          </p>
          <p>
            <a class='twitter-share-button' data-count='none' data-hashtags='howleditor' data-lang='en' data-text='The Howl Editor, a general purpose, light-weight customizable editor.' data-url='http://howl.io' href='https://twitter.com/share'>
              Tweet
            </a>
          </p>
        </div>
        <div class='footer-blurb'>
          <div>The Howl editor.</div>
          <div>
            Copyright 2012-2015
            <a class='alert-link' href='https://github.com/nilnor/howl/contributors'>
              The Howl Developers.
            </a>
          </div>
        </div>
      </div>
    </div>
    <script>
      <!-- / GA -->
      (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
      })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
      ga('create', 'UA-45283282-1', 'howl.io');
      ga('send', 'pageview');
      <!-- / Twitter -->
      !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];
      if(!d.getElementById(id)){js=d.createElement(s);js.id=id;
      js.src="//platform.twitter.com/widgets.js";
      fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
    </script>
  </body>
</html>
